const { exception } = require('../common')

const catchError = async (ctx, next) => {
  try {
    // 等待所有代码执行完毕
    await next()
  } catch (err) {
    exception(ctx, err);
  }
}

module.exports = catchError